package org.stvd.entities.message;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import org.stvd.entities.base.BaseEntity;
import org.stvd.entities.common.LongJsonDeserializer;
import org.stvd.entities.common.LongJsonSerializer;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * 消息内容-实体类
 * @author hanxin
 *
 */
@Entity
@Table(name = "bs_message_info")
public class BsMessageInfo extends BaseEntity{

    private static final long serialVersionUID = -3854200199250116627L;

    /**
     * 主键ID
     */
    @Id
    @Column(name = "id", nullable = false)
    @JsonSerialize(using = LongJsonSerializer.class)
    @JsonDeserialize(using = LongJsonDeserializer.class)
    private Long id = null;

    /**
     * 消息标题
     */
    @Column(name = "title", nullable = false)
    @NotEmpty(message="消息标题不能为空")
    @Length(max = 200, message="消息标题最大可输入200个字符")
    private String title = "";
    
    /**
     * 消息内容
     */
    @Column(name = "content", nullable = false)
    @NotEmpty(message="消息内容不能为空")
    private String content = "";
    
    /**
     * 类别{0：私信；1：公共消息；2：系统消息}
     */
    @Column(name = "type", nullable = false)
    private String type = "";
    
    /**
     *录入人{-1：系统}
     */
    @Column(name = "create_user", nullable = false)
    private String createUser = "";

    /**
     *录入时间
     */
    @Column(name = "create_time", nullable = false)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime = null;

    /**
     * 修改时间
     */
    @Column(name = "modify_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date modifyTime = null;

    @Transient
    private String recId = "";
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getRecId() {
        return recId;
    }

    public void setRecId(String recId) {
        this.recId = recId;
    }
}
